<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>选项合并</title>
</head>
<body>
<div id="example"></div>
<script src="../js/libs/vue.js"></script>
<script>
    var mixin = {
        created: function () {
            console.log('mixin hook called');
        },
        methods: {
            foo: function () {
                console.log('foo');
            },
            conflicting: function () {
                console.log('from mixin');
            }
        }
    };
    var vm = new Vue({
        mixins: [mixin],
        created: function () {
            console.log('component hook called');
        },
        methods: {
            bar: function () {
                console.log('bar');
            },
            conflicting: function () {
                console.log('from self');
            }
        }
    });
    vm.foo();
    vm.bar();
    vm.conflicting();
</script>
</body>
</html>